package com.onpositive.wiki3.catmodels;

import java.util.Arrays;
import java.util.LinkedHashSet;

import com.onpositive.nlp.inflector.SimplePOFParser;
import com.onpositive.wiki3.db.catmodel.Category;

public class PuredDateCategoryModel implements ICategoryModel {

	@Override
	public int score(Category cat) {
		String[] tokens = cat.getTokens();
		if (!Character.isDigit(tokens[0].charAt(0))) {
			return 0;
		}
		if (tokens.length > 1) {
			return 0;
		}
		boolean isSpec = false;
		boolean isNumber=false;
		int nc=0;
		for (String t : tokens) {
			
			try {
				String name = t;
				if (Character.isDigit(name.charAt(0))) {
					if (name.endsWith("s")) {
						name = name.substring(0, name.length() - 1);
					}
					if (name.endsWith("th")) {
						name = name.substring(0, name.length() - 2);
					}
					if (name.endsWith("th-century")) {
						name = name.substring(0,
								name.length() - "th-century".length());
					}
				}
				Integer.parseInt(name);
				isNumber=true;
				nc++;
			} catch (Exception e) {
				return 0;
			}
		}

		cat.setTag(ICategoryModel.PURE_DATE);
		return Integer.MAX_VALUE;
	}

	@Override
	public String name() {
		return "simple specialisation";
	}

	@Override
	public boolean isPossibleCategorization(Category cat) {
		return false;
	}

	@Override
	public String getPrimaryParentForm(Category cat) {
		return null;
	}

}
